package com.xdm.ui.adapter.android;

import xwt.ImplementationWrapper;
import android.app.Activity;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.xdm.ui.XmItemPanelView;
import com.xdm.ui.XmListAdapter;
import com.xdm.ui.XmOnItemClickListener;

public class AndroidItemPanelView extends ImplementationWrapper implements XmItemPanelView {
	
	public AndroidItemPanelView(Activity activity, String id) {
		super(id);
		this.setImplementation(activity.findViewById(new Integer(id).intValue()));
	}

	public void setAdapter(XmListAdapter adapter) {
		AndroidDecoratedTextListAdapter decoratedTextListAdapter = (AndroidDecoratedTextListAdapter) ((AndroidListAdapter)adapter).implementation;
		((ListView) implementation).setAdapter(decoratedTextListAdapter);
	}

	public void setOnItemClickListener(XmOnItemClickListener handler) {
		((ListView) implementation).setOnItemClickListener((OnItemClickListener)((AndroidOnItemClickListener)handler).getImplementation());
	}

}
